Builder

class Builder<V : Any>

Builds a ValidatedMap

Not strictly necessary, but may make construction cleaner.

Author

fzzyhmstrs

Since

0.2.0

Parameters

V

value type. any non-null type

Samples

import me.fzzyhmstrs.fzzy_config.util.Translatable
import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedEnumMap
import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedIdentifierMap
import me.fzzyhmstrs.fzzy_config.validation.collection.ValidatedStringMap
import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedBoolean
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedString
import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedFloat
import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedInt
import net.minecraft.registry.tag.ItemTags
import net.minecraft.util.Identifier
import java.util.*

fun main() { 
   //sampleStart 
   // a ValidatedMap built with the Builder.
// KeyHandler takes any String Entry, such as ValidatedIdentifier (ValidatedIdentifier is recommended, in general)
// valueHandler takes any Entry, in this case a ValidatedInt
// defaultIds takes the default map in Map<Identifier, V> form. see defaults for Map<String, V> impl
val stringTest = ValidatedStringMap.Builder<Int>()
    .keyHandler(ValidatedString("yay"))
    .valueHandler(ValidatedInt(1, 100, 0))
    .defaultIds(mapOf(Identifier("minecraft:stick") to 50))
    .build() 
   //sampleEnd
}

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard

Functions

Link copied to clipboard

Defines the Entry used to handle validation, serialization, etc. for map keys